<#assign ctx=request.contextPath />
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>Login</title>
    <link rel="stylesheet" href="style2.0.css">
    <link rel="stylesheet" href="css.css">
    <script type="text/javascript" src="${ctx}/md5.js"></script>
    <script type="text/javascript" src="${ctx}/register.js"></script>
    <script type="text/javascript" src="${ctx}/jquery-1.8.0.min.js"></script>
</head>
<body>
<div id="contPar" class="contPar">
    <div id="page1" style="z-index:1;">
        <div class="title0">智能水务工单系统</div>
        <div class="title1">计量、分析、漏控、监管</div>
        <div class="imgGroug">
            <ul>
                <img class="img0 png" src="page1_0.png">
                <img class="img1 png" src="page1_1.png">
                <img class="img2 png" src="page1_2.png">
            </ul>
        </div>
        <img class="img3 png" src="page1_3.jpg">
    </div>
</div>
<div class="empty"></div>
<form id="frm1" name="frm1" action="${ctx}/login" method="post" class="login_lo">
    <div class="lo_1">
        <img src="yong.png">
        <input type="text" name="username" id="username"/>
    </div>
    <div class="lo_1">
        <img src="mi.png">
        <input type="password" name="password" id="passwd"/>
    </div>

    <div class="lo_2">
        <input type="checkbox" checked="checked" id="remember-me" name="remember-me"/>
        <label for="remember">记住登录状态</label>
    </div>

    <#if RequestParameters.error??>
    <span id="error" class="help-block" style="color:red;">用户名或密码错误，请重新登录.
    <#if RequestParameters.msg??>
        ${msg}
    </#if>
    </span>
    </#if>

    <input type="hidden" id="timestamp" name="timestamp">
    <input type="hidden" id="salt" name="salt">
    <input type="hidden" id="clientHash" name="clientHash">

    <script type="text/javascript">

        function clogin() {
//获取密码
            var passwd = $("#passwd").val();

            var tnp = md5(passwd);
//获取时间
            var date = new Date();
            var month = date.getMonth();
            month = (month < 10 ? "0" + month : month);
            var timestamp = date.getFullYear() + "/" + month + "/" + date.getDate() +
                    " " + date.getHours() + ":" + date.getMinutes();
//随机数
            var salt = Math.floor(Math.random() * 100 + 1);
//把对象放入json传入后台

            var clientHash = md5(tnp + timestamp + salt);
            $("#timestamp").val(timestamp);
            $("#clientHash").val(clientHash);
            $("#salt").val(salt);
            $("#passwd").val(tnp);

            var msg = JSON.stringify({"time": timestamp, "clientHash": clientHash, "salt": salt});
            console.info(msg);

            frm1.submit();
        }
    </script>
    <input class="lo_login" type="button" value="    登录    " onclick="clogin()">
</form>
<div class="versions">版权申明 隐私保护｜ V1.0</div>
<script type="text/javascript" src="${ctx}/com.js"></script>
</body>
</html>